package com.hthy.futures.ui;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.hthy.futures.R;
import com.hthy.futures.bean.TradeOderStr;
import com.hthy.futures.inter.PostNewOrderClickListener;


/**
 * <br/> Description: 提交单据
 * <br/> Author:  Mr.bingley
 * <br/> Version: 1.0
 * <br/> Date:  2016/9/30 0029 上午 09:48
 */
public class BillPostDialog extends BaseDialog implements View.OnClickListener {
    private TextView mOrderMes;
    private TextView tvPrice;
    private TextView tvNum;
    private TextView tvStopProfit;
    private TextView tvStropOutPrice;

    PostNewOrderClickListener  mPostNewOrderClickListener ;
    private TextView mTv_tip;

    public BillPostDialog(Context context) {
        super(context);
    }

    @Override
    protected void initView(View contentView) {
        mOrderMes = (TextView) contentView.findViewById(R.id.tv_buy_goodsname);
        tvPrice = (TextView) contentView.findViewById(R.id.tv_price);
        tvNum = (TextView) contentView.findViewById(R.id.tv_num);
        tvStopProfit = (TextView) contentView.findViewById(R.id.tv_stop_profit);
        tvStropOutPrice = (TextView) contentView.findViewById(R.id.tv_stop_outprice);
        mTv_tip = (TextView) contentView.findViewById(R.id.tv_tip);

        Button bt_post = (Button) contentView.findViewById(R.id.bt_sure);
        Button bt_dismiss = (Button) contentView.findViewById(R.id.bt_dismiss);

        bt_post.setBackgroundResource(R.drawable.btn_common_blue_style);

        ImageView img_sellStar = (ImageView) contentView.findViewById(R.id.iv_sellstar);
        img_sellStar.setBackgroundResource(R.drawable.sell_blue_star);

        bt_dismiss.setOnClickListener(this);
        bt_post.setOnClickListener(this);
    }

    @Override
    protected int getDialogGravity() {
        return Gravity.CENTER;
    }

    @Override
    protected int getContentView() {
        return R.layout.dialog_bill_post;
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.bt_sure:  //
                // 写个监听器
                mPostNewOrderClickListener.post();
                break;
            case R.id.bt_dismiss:
                dismiss();
                break;
        }
        dismiss();
    }

    public void setPostNewOrderClickListner(PostNewOrderClickListener postNewOrderClickListener) {
        mPostNewOrderClickListener = postNewOrderClickListener;
    }

    public void setMessTip(String dialogTip) {
        mTv_tip.setText(dialogTip);
    }
}
